<?php
declare (strict_types=1);

namespace app\admin\logic\market\ticket;

use app\admin\model\market\ticket\TicketCoupon as TicketCouponModel;
use app\common\exception\LogicException;

/**
 * 活动券逻辑层
 */
class TicketCoupon extends TicketCouponModel
{
    /**
     * 获取列表
     *
     * @param array $map
     * @return \think\Paginator
     * @throws \think\db\exception\DbException
     */
    public function getList(array $map = [])
    {
        return $this->where($map)->order('create_time', 'DESC')->paginate($this->getListRows());
    }

    /**
     * 获取优惠券信息
     *
     * @param int $id
     * @return TicketCoupon|array|\think\Model
     */
    public function getInfoById(int $id)
    {
        return $this->where('id', $id)->findOrEmpty();
    }
}
